﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PFMCandidate;
using PFMConfigurations;
using System.IO;


namespace PFMHandlers
{
    public class PFMHandler:IHandler
    {
        protected byte[] bTarget;
        protected Candidate o_Cadidate;
        public virtual byte[] Perform(PFMCandidate.Candidate aCandidate, byte[] baTarget)
        {
            this.bTarget = baTarget;
            this.o_Cadidate = aCandidate;
            return null;            
        }
        protected virtual void CheckForDelete()
        {
          
        }
        protected byte[] GetProcessingData(Candidate aCandidate, byte[] baTarget)
        {
            byte[] sResult = null;

            if (baTarget == null)
            {
                PFMHandler aFileHandler = new PFMFileHandler();
                sResult = aFileHandler.Perform(aCandidate, null);
            }
            else
                sResult = baTarget;

            return sResult;
        }
        protected virtual void ChangeCandidateProcessedName(Candidate aCandidate)
        {
            if (aCandidate.ProcessedName == null || aCandidate.ProcessedName == "")
                aCandidate.ProcessedName = Path.GetFileName(aCandidate.Name);
        }
    }
}
